﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="POption_Add.aspx.cs"   MasterPageFile="~/Admin/Admin.Master"  Inherits="TimKen.Web.Admin.PAttribute.POption_Add" %>

<asp:Content runat="server" ContentPlaceHolderID="ContentLinkAction" ID="link">
    <span class="action-span">
 <asp:HyperLink ID="hlTypeOptionList" runat="server" Visible="false"><%=GetLangString("CategoryOptionList")%></asp:HyperLink>
 </span>
 
   <span class="action-span">
 <asp:HyperLink ID="hlOptionManage" runat="server" Visible="false" NavigateUrl="POption_Manage.aspx"><%=GetLangString("OptionList")%></asp:HyperLink>
 </span>
</asp:Content>

<asp:Content ContentPlaceHolderID="ContentTitle" runat="server" ID="Content2">
    <%=GetLangString("MenuProductOption")%>
</asp:Content>

<asp:Content ContentPlaceHolderID="ContentMain" runat="server" ID="Content1">
    <script type="text/javascript">
        function checkForm() {
            if (document.getElementById("<%=this.txtAttrNameCN.ClientID%>").value == "" || document.getElementById("<%=this.txtAttrNameEN.ClientID%>").value == "") {
                alert(x_OptionNameNotAllowBlank);
                return false;
            }

            var fieldID = "<%=rblFieldType.ClientID%>";
            var fieldType = "";
            for (var i = 0; i < 3; i++) {
                var field = document.getElementById(fieldID + "_" + i);
                if (field.checked) {
                    fieldType = field.value;
                }
            }

            if (fieldType == "") {
                alert(x_FieldTypeNotAllowBlank);
                return false
            }
            if (fieldType == "2" && (document.getElementById("<%=this.txtFieldMetaDataCN.ClientID%>").value == "" || document.getElementById("<%=this.txtFieldMetaDataEN.ClientID%>").value == "")) {
                alert(x_FieldMetaDataNotAllowBlank);
                return false
            }
            return true;
        }

        // 点击类型按钮时切换选项的禁用状态

        function radioClicked(n) {
            if (n != 2) {
                document.forms[0].elements["<%=txtFieldMetaDataCN.ClientID%>"].value = "";
                document.forms[0].elements["<%=txtFieldMetaDataEN.ClientID%>"].value = "";
            }
            document.forms[0].elements["<%=txtFieldMetaDataCN.ClientID%>"].disabled = n == 2 ? false : true;
            document.forms[0].elements["<%=txtFieldMetaDataEN.ClientID%>"].disabled = n == 2 ? false : true;
        }
    </script>

    <div class="main-div">
        <table width="100%" id="general-table">
            <tr>
                <th class="label">
                    <%=GetLangString("OptionName")%>：
                </th>
                <td>
                    <ux:LanguagePic ID="LanguagePic3" runat="server" languageName="Chinese" />
                    <asp:TextBox runat="server" ID="txtAttrNameCN"></asp:TextBox>
                    <ux:LanguagePic ID="LanguagePic4" runat="server" languageName="English" />
                    <asp:TextBox runat="server" ID="txtAttrNameEN"></asp:TextBox>
                    <span class="require-field">*</span>
                </td>
            </tr>
            <tr>
                <th class="label">
                    <%=GetLangString("OptionFieldType")%>：
                </th>
                <td>
                    <asp:RadioButtonList ID="rblFieldType" runat="server" RepeatDirection="Horizontal">
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr>
                <th class="label">
                    <%=GetLangString("FieldMetaData")%>：
                </th>
                <td>
                    <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                            <td width="28px">
                                <ux:LanguagePic ID="LanguagePic2" runat="server" languageName="Chinese" />
                            </td>
                            <td width="185px">
                                <asp:TextBox runat="server" ID="txtFieldMetaDataCN" Height="75px" TextMode="MultiLine"
                                    Width="175px"></asp:TextBox>
                            </td>
                            <td width="28px">
                                <ux:LanguagePic ID="LanguagePic1" runat="server" languageName="English" />
                            </td>
                            <td>
                                <asp:TextBox runat="server" ID="txtFieldMetaDataEN" Height="75px" TextMode="MultiLine"
                                    Width="175px"></asp:TextBox>
                                <span class="require-field">*</span>
                            </td>
                            
                            
                             
                            
                        </tr>
                    </table>
                </td>
            </tr>
            
            
             <asp:Panel ID="panelSearchAble" runat="server" Visible="false">
            <tr>
              <th class="label">
                         <%=GetLangString("IsSearchAble")%>：
                </th>
                <td>
                     <asp:CheckBox  ID="cbAttributeIndex" runat="server" />
                </td>
            </tr>
            </asp:Panel>
            
            <tr>
                <td colspan="2">
                    <div class="button-div">
                        <asp:Button ID="btnOK" runat="server" CssClass="button" OnClick="btnOK_Click" OnClientClick="return checkForm();" />
                        &nbsp;&nbsp;
                        <asp:Button ID="btnCancel" runat="server" CssClass="button" />
                    </div>
                </td>
            </tr>
        </table>
    </div>
 
</asp:Content>
